package com.o2o.app.utils;

public class DataUtil {
	private static final long serialVersionUID = 1L;

	private static String friendsName;
	private static int picSize;
	private static String picPath;
	private static byte[] picRes;

	/**
	 * @return 返回 friendsName
	 */
	public static String getFriendsName() {
		return friendsName;
	}

	/**
	 * @param 对friendsName进行赋值
	 */
	public static void setFriendsName(String friendsName) {
		DataUtil.friendsName = friendsName;
	}

	/**
	 * @return 返回 picSize
	 */
	public static int getPicSize() {
		return picSize;
	}

	/**
	 * @param 对picSize进行赋值
	 */
	public static void setPicSize(int picSize) {
		DataUtil.picSize = picSize;
	}

	/**
	 * @return 返回 picPath
	 */
	public static String getPicPath() {
		return picPath;
	}

	/**
	 * @param 对picPath进行赋值
	 */
	public static void setPicPath(String picPath) {
		DataUtil.picPath = picPath;
	}

	/**
	 * @return 返回 picRes
	 */
	public static byte[] getPicRes() {
		return picRes;
	}

	/**
	 * @param 对picRes进行赋值
	 */
	public static void setPicRes(byte[] picRes) {
		DataUtil.picRes = picRes;
	}

	/**
	 * 因为android上面判断每一个汉字长度为3个字节，数据库是2个字节，做一下转换
	 * 
	 * @param str
	 * @return
	 */
	public static int lenString(String str) {
		char[] ch = str.toCharArray();
		int num = 0;

		for (int i = 0; i < ch.length; i++) {
			if (String.valueOf(ch[i]).getBytes().length == 1) {
				num += 1;
			} else if (String.valueOf(ch[i]).getBytes().length == 3) {
				num += 2;
			} else {
				num += 1;
			}
		}
		return num;
	}
}
